//
//  MyFriendCell.m
//  FreeTime
//
//  Created by  on 16/9/1.
//  Copyright © 2016年 SRDZ.com. All rights reserved.
//

#import "MyFriendCell.h"
#import "Header.h"

@interface MyFriendCell (){
    UILabel * titleLbl;
}


@end


@implementation MyFriendCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.dayLbl = [UILabel new];
        _dayLbl.font = [UIFont boldSystemFontOfSize:19];
        _dayLbl.textColor = [UIColor blackColor];
//        _dayLbl.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_dayLbl];
        
        self.monthLbl = [UILabel new];
        _monthLbl.font = [UIFont boldSystemFontOfSize:14];
        _monthLbl.textColor = [ImageUtil colorWithRgb:0x999999];
        [self.contentView addSubview:_monthLbl];
        
        
        self.imgView = [UIImageView new];
        _imgView.userInteractionEnabled = YES;
        _imgView.backgroundColor = DEBUG_CLOLR;
        [self.contentView addSubview:_imgView];
        
        titleLbl = [UILabel new];
        titleLbl.font = FONT(14);
        titleLbl.numberOfLines =0;
        titleLbl.textColor = [ImageUtil colorWithRgb:0x666666];
        [self.contentView addSubview:titleLbl];

        
    }
    return self;
}
- (void)bindData:(NSMutableDictionary *)dic indexPath:(NSIndexPath *)indexPath
{
    self.dayLbl.frame = [dic[@"dayFrame"] CGRectValue];
    self.monthLbl.frame = [dic[@"monthFrame"] CGRectValue];
    self.imgView.frame = [dic[@"imgFrame"] CGRectValue];
    titleLbl.frame = [dic[@"titleFrame"] CGRectValue];
    
    self.dayLbl.text = @"112";
    self.monthLbl.text = @"333";
    UIImageView * image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
    image.image = [UIImage imageNamed:@"123"];
    [self.imgView addSubview:image];
    titleLbl.text = dic[@"title"];

}

+ (NSMutableDictionary *)cellFrame:(NSMutableDictionary *)dic indexPath:(NSIndexPath *)indexPath{
   dic = [MyFriendCell turn:dic indexPath:indexPath];
    CGRect dayFrame = CGRectMake(10, 0, 70, 20);
    CGRect monthFrame = CGRectMake(10, CGRectGetMaxY(dayFrame)+5, 70, 15);
    CGRect imgFrame = CGRectMake(CGRectGetMaxX(monthFrame), 0, 80, 80);
    CGRect titleFrame = CGRectMake(CGRectGetMaxX(imgFrame)+10, 3, WindowWidth-CGRectGetMaxX(imgFrame)-20, 74);
    CGFloat cellHeight = CGRectGetMaxY(imgFrame)+10;
    [dic setObject:[NSValue valueWithCGRect:dayFrame] forKey:@"dayFrame"];
    [dic setObject:[NSValue valueWithCGRect:monthFrame] forKey:@"monthFrame"];
    [dic setObject:[NSValue valueWithCGRect:imgFrame] forKey:@"imgFrame"];
    [dic setObject:[NSValue valueWithCGRect:titleFrame] forKey:@"titleFrame"];
    [dic setObject:[NSNumber numberWithFloat:cellHeight] forKey:@"cellHeight"];
    return dic;
}

+ (NSMutableDictionary*)turn:(NSMutableDictionary *)dict indexPath:(NSIndexPath *)indexPath{
    return [NSMutableDictionary dictionaryWithDictionary:dict];
}

@end
